// CalendarDlg.cpp : implementation file
//

#include "stdafx.h"
#include "TaskOrg.h"
#include "CalendarDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCalendarDlg dialog


CCalendarDlg::CCalendarDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCalendarDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCalendarDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CCalendarDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCalendarDlg)
	DDX_Control(pDX, IDC_CALENDAR1, m_ctlCalendar);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCalendarDlg, CDialog)
	//{{AFX_MSG_MAP(CCalendarDlg)
	ON_BN_CLICKED(IDC_PREVMONTH, OnPrevmonth)
	ON_BN_CLICKED(IDC_NEXTMONTH, OnNextmonth)
	ON_BN_CLICKED(IDC_NEXTWEEK, OnNextweek)
	ON_BN_CLICKED(IDC_PREVWEEK, OnPrevweek)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCalendarDlg message handlers

short CCalendarDlg::GetDay()
{
	return m_day;
}

void CCalendarDlg::OnOK() 
{
	// TODO: Add extra validation here
	
	CDialog::OnOK();
	m_day = m_ctlCalendar.GetDay();
	m_month = m_ctlCalendar.GetMonth();
	m_year = m_ctlCalendar.GetYear();
}

short CCalendarDlg::GetMonth()
{
	return m_month;
}

short CCalendarDlg::GetYear()
{
	return m_year;
}

void CCalendarDlg::SetMonth(short m)
{
	m_month = m;
}

void CCalendarDlg::SetDay(short d)
{
	m_day = d;
}

void CCalendarDlg::SetYear(short y)
{
	m_year = y;
}



BOOL CCalendarDlg::OnInitDialog() 
{

	CDialog::OnInitDialog();

	m_ctlCalendar.SetDay(m_day);
	m_ctlCalendar.SetMonth(m_month);
	m_ctlCalendar.SetYear(m_year);

	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CCalendarDlg::OnPrevweek() 
{
	// TODO: Add your control notification handler code here
	m_ctlCalendar.PreviousWeek();
}

void CCalendarDlg::OnNextweek() 
{
	// TODO: Add your control notification handler code here
	m_ctlCalendar.NextWeek();
}

void CCalendarDlg::OnPrevmonth() 
{
	// TODO: Add your control notification handler code here
	m_ctlCalendar.PreviousMonth();	
}

void CCalendarDlg::OnNextmonth() 
{
	// TODO: Add your control notification handler code here
	m_ctlCalendar.NextMonth();	
}
